home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
c_news
/
16
/
sets
/
setsourc
/
wordlen.c
< prev
Wrap
C/C++ Source or Header
|
1989-03-09
|
792b
|
24 lines
#include <stdio.h>
#include <stdarg.h>
#include "sets.h"
/***************************************************************************/
unsigned wordlength(void)
/***************************************************************************/
/* This determines the number of bits in a standard unsigned integer. */
{
unsigned x,y; /* this is standard word length */
x = y = 0; /* zero all bits */
x = ~x; /* set all bits to '1' */
do {
x = x << 1; /* shift all bits 1 place to left; fill LSB with '0' */
y++; /* count the number of shifts */
} while(x != 0); /* when x == 0, all bits have been shifted out */
return y; /* y == number of bits in word */
} /* end wordlength */